/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package aybolit.core.objects.dao.impl;

import aybolit.core.objects.dao.HealthingDao;
import aybolit.core.objects.model.Healing;
import java.io.Serializable;
import javax.annotation.Resource;
import org.hibernate.SessionFactory;
import org.springframework.transaction.annotation.Transactional;

/**
 *
 * @author Masumov Emin
 */
@Transactional
public class HealthingDaoImp implements HealthingDao, Serializable {

    SessionFactory sessionFactory;

    @Transactional
    @Override
    public Healing findHellingByPacientId(String id) {
      return (Healing) sessionFactory.getCurrentSession().getNamedQuery("Healing.findHealingByPacientId").setParameter("h_id",Integer.parseInt(id)).uniqueResult();     
    }
    @Resource(name = "sessionFactory")
    public void setSessionFactory(SessionFactory sessionFactory) {
        this.sessionFactory = sessionFactory;
    }
    @Transactional
    @Override
    public void save(Healing h) {
        sessionFactory.getCurrentSession().save(h);
    }

}
